﻿define('viewModels/createtask', ['data/projects', 'data/tasks', 'logger', 'router', 'viewModel', 'data'],
    function(projectData, tasksData, log, router, viewModel, dataCore) {

        function view() {
            var self = this;

            function afterSave() {
                router.go('taskList');
            }

            viewModel.addEditItemBehavior(self, 'new task', 'edit task', tasksData, tasksData.NewTask, afterSave);
            self.activate = function(params, bind) {
                self.start(params, bind);
            };

            self.projects = function(initItem) {
                return dataCore.createLookup(projectData.LookupLink, initItem);
            };
        }

        return new view();    
    });